package cn.bone.alibabacloud.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController
public class ConsumerController {

    @Value("${service-url.nacos-user-service}")
    String baseUrl;

    @Resource
    private RestTemplate restTemplate;

    @RequestMapping("/consumer/payment/nacos/{id}")
    public String getPayment(@PathVariable("id")Integer id){

        String url = baseUrl + "/payment/nacos/" + id;
        String result = restTemplate.getForObject(url, String.class);
        return result;
    }
}
